package com.jiuyun.auth.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Method;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * 
 * @author z'y'l
 *
 */
public class BaseServlet extends HttpServlet {

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String url = request.getRequestURI();
		int gang = url.lastIndexOf("/");
		String work = url.substring(gang + 1);

		System.out.println(url + "你在干嘛" + work);


		Method m = null;
		try {
			m = this.getClass().getDeclaredMethod(work, HttpServletRequest.class, HttpServletResponse.class);


			m.invoke(this, request, response);
			// System.out.println(m.getName());

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
